import wepy from 'wepy'
import {
  USER_INFO,
  TOKEN
} from '@/utils/constant'
/*
  用户是否登录，无没登录去授权页面
 */
 async  function login() {
  // 检查是否登录
  let appUserInfo = wepy.getStorageSync(USER_INFO)
  let token = wepy.getStorageSync(TOKEN);
  if(appUserInfo.token &&  token){
    return
  }else{
    wepy.navigateTo({ url: '/pages/authorize' });
    return
  }
}

module.exports = {
  login:login
}
